#ifndef MY_MAIN_H__
#define MY_MAIN_H__

#include "main.h"
#include "cmsis_os.h"
#include "dma.h"
#include "fdcan.h"
#include "memorymap.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
#include "semphr.h"

#include "VESC.h"
#include "FreLib.h"
#include "gyro.h"
#include "Chassis.h"
#include "DJI_transform.h"
#include "wxyLib.h"
#include "WS2811.h"

#include "stdio.h"

void basicsTask(void *argument);
void buttonTask(void *argument);
void dribbleTask(void *argument);
void shootTask(void *argument);
void can1Task(void *argument);
void ledTask(void *argument); 


extern osMessageQueueId_t Button_BuffHandle;
extern osSemaphoreId_t ShootHandle;
extern osMessageQueueId_t other_CAN1Handle;
extern osMessageQueueId_t other_ErrHandle;
extern osMessageQueueId_t Dribble_CMDHandle;
extern osMessageQueueId_t Shoot_CMDHandle;
extern osSemaphoreId_t ShootFinishHandle;

extern osSemaphoreId_t UART_To_RCHandle;
extern osSemaphoreId_t UART_To_PCHandle;
extern osSemaphoreId_t UART_To_GyroHandle;
extern osSemaphoreId_t UART_To_RobotHandle;
/*--------------------------*/

/* 需要在其他文件调用的函数 */
void my_HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim);


/* 发送给CAN任务的结构体 */
enum eMotorMode
{
	eMotorMode_Pos,
	eMotorMode_Speed,
	eMotorMode_Duty,
	eMotorMode_Break,
	eMotorMode_Block,
	eMotorMode_Current,
};

typedef struct MotorToCAN 
{
	uint8_t ID;
	enum eMotorMode eMode;
	float Data;
}MotorToCAN;
/************************/

/* 定义错误模式 */
struct myErrState
{
	bool shootErr;
	bool dribbleErr;
	bool pcErr;
};

/****************/

enum Chassis
{
	Normal = 0,  // 正常模式
	Put = 1,     // 摆车
};

enum DribbleMode
{
	eDribble_One     = 0,
	eDribble_Two   	 = 1,
	eDribble_HandGuard = 2,
};

enum ShootMode
{
	eShoot_Bottom  = 0,
	eShoot_Catch   = 1,
	eShoot_Push    = 2,
};
/*------------*/


typedef struct ShootCMD
{
	enum ShootMode Mode;
	float Duty;
}ShootCMD;

extern uint8_t Aim_LED;

#endif 


